/*
 * Copyright 2006-2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.martinimix.service.order;

import java.util.List;

import net.martinimix.domain.account.Customer;
import net.martinimix.domain.order.Cart;
import net.martinimix.domain.order.Order;
import net.martinimix.domain.order.PriceList;

/**
 * Provides order related services.
 * 
 * @author Scott Rossillo
 *
 */
public interface OrderService {

	/**
	 * Returns the tax rate for the given order.
	 * 
	 * @param order the <code>Order</code> whose tax rate should be returned
	 * 
	 * @return the percentage of the given <code>order</code>'s sub-total 
	 * which must be collected for tax purposes
	 */
	public double calculateTaxRate(Order order);
	
	/**
	 * Creates an order for the given customer and shopping cart.
	 * 
	 * @param customer the <code>Customer</code> for the order to create
	 * 
	 * @param cart the shopping <code>Cart</code> for the order to create
	 * 
	 * @return a new <code>Order</code> for the given <code>customer</code>
	 * and <code>cart</code>
	 */
	public Order createOrder(Customer customer, Cart cart, PriceList priceList);
	
	/**
	 * Creates the planned shipments for the given order.
	 * 
	 * @param order the <code>Order</code> to create 
	 * <code>PlannedShipment</code>s for
	 * 
	 * @return a <code>List</code> containing the 
	 * <code>PlannedShipment</code>s created for
	 * the given <code>order</code> 
	 */
	public List createPlannedShipments(Order order);
	
	/**
	 * Returns the order identified by the given order id.
	 * 
	 * @param orderId the identifier for the order to be returned
	 * 
	 * @return the <code>Order</code> identified by the given
	 * <code>orderId</code>
	 */
	//public Order findOrder(Long orderId);
	
	/**
	 * Saves the given order.
	 * 
	 * @param order the <code>Order</code> to be saved
	 */
	public void saveOrder(Order order, Cart cart);
	
	
}
